if (!window.Stack) var Stack = function () {
    var buff = [];
    var current = null;

    this.size = function () { return buff.length; };
    this.push = function (value) { buff.push (current = value); };
    this.pop = function () {
        if (buff.length == 0)
            throw "Can't popup element from empty stack";
        return current = buff.pop ();
    };
    this.peek = function () { return current; };
    this.isEmpty = function () { return (buff.length == 0); }
};